import {
    createRouter,
    createWebHistory,
    createWebHashHistory
} from 'vue-router'
import Login from '../pages/Login.vue'
// 首页
import index from '../pages/index.vue'
// 我的规划模块
import Allthings from '../pages/Allthings.vue'
import oneDay from '../pages/oneDay.vue'
import oneWeek from '../pages/oneWeek.vue'
import oneMonth from '../pages/oneMonth.vue'

// 辅助工具模块
import timer from '../pages/timer.vue'
import notes from '../pages/notes.vue'

// 统计数据模块
import weekStatistics from '../pages/weekStatistics.vue'
import monthStatistics from '../pages/monthStatistics.vue'
import yearStatistics from '../pages/yearStatistics.vue'

// 个人信息模块
import userInfo from '../pages/userInfo.vue'
const routes = [{
        path: '/',
        component: Login,
        meta:{
            keepAlive: false //此页面需要缓存
        }
    },
    {
        path: '/index',
        component: index,
        redirect: '/all',
        meta: {
            keepAlive: false //此页面需要缓存
        },
        children: [{
                path: '/all',
                component: Allthings,
                meta: {
                    keepAlive: false //此页面需要缓存
                }
            },
            {
                path: '/oneDay',
                component: oneDay,
                meta: {
                    keepAlive: false //此页面需要缓存
                }
            },
            {
                path: '/oneWeek',
                component: oneWeek,
                meta: {
                    keepAlive: false //此页面需要缓存
                }
            },
            {
                path: '/oneMonth',
                component: oneMonth,
                meta: {
                    keepAlive: false //此页面需要缓存
                }
            },
            {
                path: '/timer',
                component: timer,
                meta: {
                    keepAlive: true //此页面需要缓存
                }
            },
            {
                path: '/notes',
                component: notes,
                meta: {
                    keepAlive: false //此页面需要缓存
                }
            },
            {
                path: '/weekStatistics',
                component: weekStatistics,
                meta: {
                    keepAlive: false //此页面需要缓存
                }
            },
            {
                path: '/monthStatistics',
                component: monthStatistics,
                meta: {
                    keepAlive: false //此页面需要缓存
                }
            },
            {
                path: '/yearStatistics',
                component: yearStatistics,
                meta: {
                    keepAlive: false //此页面需要缓存
                }
            },
            {
                path: '/userInfo',
                component: userInfo,
                meta: {
                    keepAlive: false //此页面需要缓存
                }
            }
        ]
    }
]

const router = createRouter({
    // history: createWebHistory(),
    history: createWebHashHistory(),
    routes,
})

export default router;